package models

type User struct {
	Model
	Username   string `json:"username" gorm:"type:varchar(32);not null;unique;comment:用户名" validate:"required,min=4,max=20"`
	Password   string `json:"password" gorm:"type:varchar(512);not null;comment:密码" validate:"required min=8"`
	Nickname   string `json:"nickname" gorm:"type:varchar(128);comment:昵称"`
	Email      string `json:"email" gorm:"type:varchar(256);comment:邮箱"`
	Mobile     string `json:"mobile" gorm:"type:varchar(16);comment:电话"`
	Avatar     string `json:"avatar" gorm:"type:varchar(512);comment:头像"`
	Gender     int    `json:"gender" gorm:"type:int;not null;default:0;comment:性别 0:未知 1:男 2:女" validate:"min=0,max=2"`
	Superadmin int    `json:"superadmin" gorm:"type:int;not null;default:0;comment:是否是管理员 0:否 1:是" validate:"min=0,max=1"`
	ModelTime
}

type Log struct {
	Model
	Action   string `json:"action" gorm:"type:varchar(64);not null;comment:动作" validate:"required"`
	Grade    int    `json:"gender" gorm:"type:int;not null;default:1;comment:等级 1:信息 2:警告 3:错误" validate:"min=1,max=3"`
	Describe string `json:"describe" gorm:"type:longtext;comment: 描述"`
	Ip       string `json:"ip" gorm:"type:varchar(64);comment:IP地址"`
	Username string `json:"username" gorm:"type:varchar(32);comment:用户名" validate:"required,min=4,max=20"`
	ModelTime
}
